<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>设置</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="../../css/main.css" />
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../../js/fanhui.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/tuichu.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<header>
				<van-nav-bar title="设置"  left-arrow class="bg_color" @click-left="onClickLeft"></van-nav-bar>
			</header>
			<section>
				<van-cell @click="change" title="修改登录密码" is-link class="margin-t padding border"></van-cell>
				<van-cell title="清理缓存" is-link class="padding"></van-cell>
				<van-cell>
					<van-button size="large" type="danger" @click="back" >退出登录</van-button>
				</van-cell>
				
			</section>
		</div>
	</body>
	<script>
		var vm= new Vue({
			el:"#app",
			data:{
			},
			methods:{
				onClickLeft:function(){
						var ws=plus.webview.currentWebview()
						plus.webview.close(ws);
				},
				change:function(){
					var modify=plus.webview.open("modify.html","modify",{
						zindex:1,
						scrollIndicator:'none'
					});
					console.log("修改密码");
				},
				back: function() { //退出
					var _this = this;
					var newUser = localStorage.getItem("user"); //从localStorage里取数据(字符串格式)
					newUser = JSON.parse(newUser); //把字符串格式转换成Json格式
					if(newUser!=null){
						_this.$dialog.confirm({
							title: '确定退出登录吗'
						}).then(() => {
							//确认按钮
							localStorage.clear();//清除用户信息
							var presonal=plus.webview.getWebviewById("presonal");
							presonal.reload(true);
							plus.webview.close(plus.webview.currentWebview(),"slide-out-left");//关闭当前页面,返回个人中心
						}).catch(() => {
							//取消按钮
						});
					}else{
						_this.$dialog.confirm({
							title: '您还未登录，是否登录？'
						}).then(() => {
							//确认按钮
							plus.webview.close(plus.webview.currentWebview(),"slide-out-left");//关闭当前页面,返回个人中心
				            plus.webview.create("login.html","login").show("slide-out-left");
						}).catch(() => {
							//取消按钮
							
						});
					}
				}
			}
		})
	</script>
</html>